//package cn.fl.mcr.controller;
//
//import cmm.mid.core.framework.dto.DataResultDTO;
//import cmm.mid.core.framework.page.ListPageVO;
//import cn.cmm.base.framework.utils.BaseLogUtils;
//import cn.fl.framework.base.context.CurrentThreadContext;
//import cn.lionbridgecapital.loan.model.base.Pager;
//import cn.lionbridgecapital.loan.model.condition.McrCouponMainQC;
//import cn.lionbridgecapital.loan.model.condition.McrCouponRedQC;
//import cn.lionbridgecapital.loan.model.dto.McrCouponRecordDTO;
//import cn.lionbridgecapital.loan.model.enu.IsSuccessType;
//import cn.lionbridgecapital.loan.model.exception.BaseException;
//import cn.lionbridgecapital.loan.service.api.IMcrCouponApiService;
//import com.alibaba.fastjson.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.propertyeditors.CustomDateEditor;
//import org.springframework.web.bind.ServletRequestDataBinder;
//import org.springframework.web.bind.annotation.InitBinder;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.servlet.ModelAndView;
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author yangqh521
// * @date 2020/5/18
// * @desp 优惠券领取记录列表
// */
//@RestController
//@RequestMapping("/mcr/mcrCouponRed")
//public class McrCouponRedController {
//
//    private static final Logger logger = LoggerFactory.getLogger(McrCouponRedController.class);
//
//    @Autowired
//    private IMcrCouponApiService mcrCouponApiService;
//
//
//    /**
//     * 日期参数绑定
//     * @param binder
//     */
//    @InitBinder
//    public void initBinder(ServletRequestDataBinder binder){
//        CustomDateEditor customDateEditor = new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true);
//        binder.registerCustomEditor(Date.class, customDateEditor);
//    }
//
//    /**
//     * 到列表页面
//     */
//    @RequestMapping("/toListPage.do")
//    public ModelAndView toListPage() {
//        ModelAndView view = new ModelAndView("/mcr/mcrCouponRed/mcrCouponRedList");
//        BaseLogUtils.info(logger, "toListPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
//        return view;
//    }
//
//
//    /**
//     * 列表数据
//     * @param page
//     * @param pagesize
//     * @return
//     */
//    @RequestMapping("/initList.do")
//    public ListPageVO initList(@RequestParam(defaultValue = "1") Integer page,
//                               @RequestParam(defaultValue = "10")Integer pagesize,
//                               McrCouponRedQC qc) {
//        // 查询
//        Pager queryPager = new Pager();
//        queryPager.setCurrentPage(page);
//        queryPager.setEveryPage(pagesize);
//        queryPager.setCondition(qc);
//        BaseLogUtils.info(logger, "initList", "获取列表, queryPager:" + JSONObject.toJSONString(queryPager),
//                CurrentThreadContext.getCurrentUserName());
//
//        // 初始化返回数据
//        Integer totalCount = 0;
//        List<McrCouponRecordDTO> resultList = new ArrayList<>();
//        try {
//            BaseLogUtils.info(logger, "initList", "API获取列表, queryPager:" + JSONObject.toJSONString(queryPager));
//            DataResultDTO dataResultDTO = null;
//            BaseLogUtils.info(logger, "initList", "API获取列表, dataResultDTO:" + JSONObject.toJSONString(dataResultDTO));
//
//            if (dataResultDTO != null && dataResultDTO.getSuccess() == IsSuccessType.SUCCESS.getCode()) {
//                Map<String, Object> resultMap = (Map<String, Object>)dataResultDTO.getData();
//                totalCount = (Integer) resultMap.get("totalCount");
//                resultList = (List<McrCouponRecordDTO>) resultMap.get("resultList");
//            }
//
//        } catch (BaseException e) {
//            BaseLogUtils.error(logger, "initList", "获取列表异常, queryPager:" + JSONObject.toJSONString(queryPager),
//                    CurrentThreadContext.getCurrentUserName(), e);
//        }
//
//        // 返回数据
//        ListPageVO<McrCouponRecordDTO> listPageVO = new ListPageVO<>(resultList, totalCount);
//        BaseLogUtils.info(logger, "initList", "获取列表, listPageVO:" + JSONObject.toJSONString(listPageVO),
//                CurrentThreadContext.getCurrentUserName());
//        return listPageVO;
//    }
//
//
//
//}
